<!--#include file="p1.asp" -->
<%
dim action
action=easp.var("action")
if action="xx" then
	xx

elseif action="dbsdel" then
	dbsdel
elseif action="newDb" then
	createdb
end if

Function dbsdel
	dim ret
	if easp.var("dbName")<>"" then 
		Easp.Fso.Del(Easp.Fso.MapPath("dbs/" & easp.var("dbName") & ".mdb"))
	end if
	ret=Easp.Db.Del ("dbs","id={id}")
	ret1(ret)
End Function

sub createdb()
	dim DBName,dbstr,myCat
	dim sqla(5)
	on error resume next
	DBName = request(frmp("dbName"))
	dbstr = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & server.mappath("/") & "\dzps\dbs\" & DBName & ".mdb"
	Set myCat = Server.CreateObject( "ADOX.Catalog" ) 
	myCat.Create dbstr
	
	if err <> 0 then
		response.write dbstr
		response.write err.description
		response.write err.description
	else
		' echo "1"
	end if
	sqla(0)= cr2("dbs","dbName")
	ret=execsw(sqla)
	if ret=1 then
		echo "1"
	end if
end sub	


Function xx()
	dim sql
	vas "username",session("username")
	sql="select * from [dbs] where dbName like '%{=dbName}%' and id in (select t_db4qx_id from t_qx where username={username}) order by id desc"
	qry2json(sql)
end function
%>